package com.sumainfor.pc.market.controller.gmio;

import com.sumainfor.common.util.FieldCheckUtil;
import com.sumainfor.common.util.JsonResult;
import com.sumainfor.pc.market.service.HousingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * 功能描述:
 *
 * @Auther: zhlu
 * @Date: 2019/5/5 18:44
 * @Description:
 */
@RestController
@RequestMapping("/key/allhou")
public class AllHousingController {

    @Autowired
    HousingService HousingService;

    /**
     * 功能描述:
     * 获取所有房源资料(字段可扩展)
     * @Author zhlu
     * @Description //TODO
     * @Date 2019/5/5 16:21
     */
    @GetMapping("/getAllHousingArrList")
    public JsonResult getAllHousingArrList(){
        JsonResult result=new JsonResult();
        return result.put(HousingService.getAllHousingArrList());
    }

    /**
     * 功能描述:
     * 获取所有房源资料(字段可扩展)
     * @Author zhlu
     * @Description //TODO
     * @Date 2019/5/5 16:21
     */
    @GetMapping("/getAllHousingList")
    public JsonResult getAllHousingList(){
        JsonResult result=new JsonResult();
        return result.put(HousingService.getAllHousingLists());
    }

    /**
     * 功能描述: 
     * 运营部根据退租账单编号获取房源物品清单
     * @Author zhlu
     * @Description //TODO
     * @Date 2019/5/20 10:55
     */
    @ResponseBody
    @RequestMapping(value = "/getWithHouConInfoList")
    public JsonResult getWithHouConInfoList(@RequestParam Map<String,Object> params){
        JsonResult result=new JsonResult();
        if(!FieldCheckUtil.isMapFieldNotNull(params,new String[]{"HouInfoId"})){
            result.putFailed("HouInfoId不能为空！");
            return  result;
        }
        return result.put(HousingService.getWithHouConInfoList(params));
    }

}
